package structuralPatterns.decorator;

interface Shape {
    void draw();
}

class BorderDecorator implements Shape {
    Shape shape;

    public BorderDecorator(Shape shape) {
        this.shape = shape;
    }

    @Override
    public void draw() {
        shape.draw();
        System.out.println("Border");
    }
}

class RotateDecorator implements Shape {
    Shape shape;

    public RotateDecorator(Shape shape) {
        this.shape = shape;
    }

    @Override
    public void draw() {
        shape.draw();
        System.out.println("Rotate");
    }
}

class Rectangle implements Shape {
    @Override
    public void draw() {
        System.out.println("Rectangle");
    }
}

public class DecoratorPattern {
    public static void main(String[] args) {
        Shape shape = new Rectangle();
        RotateDecorator rotateDecorator = new RotateDecorator(shape);
        BorderDecorator borderDecorator = new BorderDecorator(rotateDecorator);
        borderDecorator.draw();
    }
}
